package com.tanguy.user.bean;

import android.support.annotation.DrawableRes;

import com.tanguy.user.R;

/**
 * Created by dab on 2017/11/10 0010 15:40
 */

public class CouponsBean {

    /**
     * id : 3
     * money : 5
     * starttime : 1508746717000
     * endtime : 1509610720000
     * state : 2
     * userId : 1
     * israng : 1
     * type : 1
     */

    private int id;
    private double money;
    private long starttime;
    private long endtime;
    private int state;//优惠券状态 1=未使用 2=已使用 3=已过期
    private int userId;
    private int israng;
    private int type;//类型 1=出行券 2=酒店券

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public long getStarttime() {
        return starttime;
    }

    public void setStarttime(long starttime) {
        this.starttime = starttime;
    }

    public long getEndtime() {
        return endtime;
    }

    public void setEndtime(long endtime) {
        this.endtime = endtime;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getIsrang() {
        return israng;
    }

    public void setIsrang(int israng) {
        this.israng = israng;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "CouponsBean{" +
                "id=" + id +
                ", money=" + money +
                ", starttime=" + starttime +
                ", endtime=" + endtime +
                ", state=" + state +
                ", userId=" + userId +
                ", israng=" + israng +
                ", type=" + type +
                '}';
    }

    /**
     * 获取卷的类型
     *
     * @return
     */
    public String getTypeString() {
        return type == 1 ? "出行券" : "酒店券";
    }

    /**
     * 获取卷的背景图片
     *
     * @return
     */
    @DrawableRes
    public int viewBackground() {
        return state == 1 ? R.mipmap.youhuiquan_weishiyong : R.mipmap.youhuiquan_yishiyong;
    }

    /**
     * 获取这个卷的用途
     *
     * @return
     */
    public String getPurpose() {
        return type == 1 ? "仅限接送机/接送站使用" : "仅限酒店预定使用";
    }

    @DrawableRes
    public int getIcon() {
        switch (state) {
            case 1:
                return R.mipmap.fenxiang;
            case 2:
                return R.mipmap.yishiyong;
            default:
                return R.mipmap.yiguoqi;
        }
    }
}
